﻿using System.Collections.Generic;

namespace Borg.Console.Contracts
{
    public enum MessageType
    {
        Normal,
        Warning,
        Error,
        Bold,
    }

    public interface IOptions
    {
        bool Contains(string name);
        string Get(string name);
        string Get(string context, string name);
    }

    public interface IConsoleWriter
    {
        void WriteList(IList<string> items, MessageType type);
        void WriteLine(object item, MessageType type);
        void WriteLine(string item, MessageType type);
    }

    public interface IInterpreterContext
    {
        string Command { get; }
        IList<string> Parameters { get; }
        IConsoleWriter Writer { get; }
        IOptions Options { get; }
    }

    public interface ICommand
    {
        string Name { get; }
        string Help { get; }

        void Execute(IInterpreterContext context);
        IEnumerable<string> GetPossibleParameterValues(
            int parameterIndex, string current, IList<string> parameters);
    }

    [SlotDefinition("Borg.CommandLibrary")]
    public interface ICommandLibrary
    {
        IEnumerable<ICommand> Commands { get; }
    }
}
